//
//  TabBarViewController.m
//  LimitFree
//
//  Created by Hailong.wang on 15/8/26.
//  Copyright (c) 2015年 Hailong.wang. All rights reserved.
//

#import "TabBarViewController.h"
#import "NavigationViewController.h"
#import "DownViewController.h"
#import "FreeViewController.h"
#import "HotViewController.h"
#import "LimitViewController.h"
#import "SpecialViewController.h"
#import "MyTableViewController.h"
@interface TabBarViewController ()

@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //创建子视图控制器
    [self createViewControllers];
}

- (void)createViewControllers {
    //限免
    LimitViewController *lvc = [[LimitViewController alloc] init];
    NavigationViewController *limit = [[NavigationViewController alloc] initWithRootViewController:lvc];
    limit.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"限免" image:[[UIImage imageNamed:@"tabbar_limitfree.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_limitfree_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    //降价
    DownViewController *dvc=  [[DownViewController alloc] init];
    NavigationViewController *down = [[NavigationViewController alloc] initWithRootViewController:dvc];
    down.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"降价" image:[[UIImage imageNamed:@"tabbar_reduceprice.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_reduceprice_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    //免费
    FreeViewController *fvc = [[FreeViewController alloc] init];
    NavigationViewController *free = [[NavigationViewController alloc] initWithRootViewController:fvc];
    free.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"免费" image:[[UIImage imageNamed:@"tabbar_appfree.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_appfree_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    //专题
    //SpecialViewController *svc = [[SpecialViewController alloc] init];
    MyTableViewController*svc=[[MyTableViewController alloc]init];
    NavigationViewController *special = [[NavigationViewController alloc] initWithRootViewController:svc];
    special.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"专题" image:[[UIImage imageNamed:@"tabbar_subject.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_subject_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    //热榜
    HotViewController *hvc = [[HotViewController alloc] init];
    NavigationViewController *hot = [[NavigationViewController alloc] initWithRootViewController:hvc];
    hot.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"热榜" image:[[UIImage imageNamed:@"tabbar_rank.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_rank_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    self.viewControllers = @[limit, down, free, special, hot];
    self.tabBar.barTintColor=[UIColor blackColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
